package com.ashapo;

import java.util.HashSet;

/**
 *
 * @author Administrator
 */
public class Ashapo {

	/**
	 * @param args the command line arguments
	 */
	public static void main(String[] args) {
		Student cfz = new Student("070801136", 26, "陈峰展不错还好的吧哈哈哈哈");
		Student lyp = new Student("060801233", 28, "梁燕萍");
		Student cjz = new Student("121301415", 23, "陈金展");
		
		Student fz2 = new Student("070801136", 26, "陈峰展");
		Student yp2 = new Student("060801233", 28, "梁燕萍");
		
		Chapter sbo = new Chapter();
		sbo.setName("07计师本1班");
		sbo.setAddress("漳州师范学院");
		sbo.addStudent("001", cfz);
		sbo.addStudent("007", lyp);
		if(sbo.hasStudent(yp2)){
			System.out.println("梁燕萍在这里呢");
		}else{
			System.err.println("梁燕萍不在这里");
		}
		
		HashSet<Student> stds = new HashSet<>();
		stds.add(fz2);
		stds.add(yp2);
		stds.add(cjz);
		if(sbo.hasStudents(stds)){
			System.out.println("学生都在这里呢");
		}else{
			System.out.println("学生没都在这里");
		}
		
		//测试hashCode
		Course sx = new Course("数学", "一学期", 3);
		Course yy = new Course("语文", "一学期", 40);
		Course ty = new Course("体育", "半学期", 25);
		
		Course sx2 = new Course("数学");
		Course ty2 = new Course("体育");
		Course wl2 = new Course("物理");
		
		cfz.selectCourse(yy);
		cfz.selectCourse(sx);
		cfz.selectCourse(ty);
		
		System.out.println("比较两个课程对象:" + ty.equals(ty2));
		
		//需要先比较hashCode再使用equals
		System.out.println("CFZ有选体育课吗:" + cfz.hasSelectedCourse(ty2));
		System.out.println("CFZ有选物理课吗:" + cfz.hasSelectedCourse(wl2));
		System.out.println("CFZ选数学的下标:" + cfz.courseIndex(sx2));
		System.out.println("CFZ选体育的下标:" + cfz.courseIndex(ty2));
		System.out.println("CFZ选物理的下标:" + cfz.courseIndex(wl2));
		
		boolean has_007 = sbo.hasStudentById("007");
		System.out.println("班级里有007:" + has_007);
		
		cfz.sortCourse();
		
		//测试进制
		Ary ary = new Ary(123, "10001");
		System.out.println("转化成16进制:" + ary.to16());
		System.out.println("转化成8进制:" + ary.to8());
		System.out.println("转化成2进制:" + ary.to2());
		
		System.out.println("作为16进制转成10进制:" + ary.get10(16));
		System.out.println("作为8进制转成10进制:" + ary.get10(8));
		System.out.println("作为2进制转成10进制:" + ary.get10(2));
	}
	
}